const crypto = require('crypto');
const fs = require('fs');
module.exports = {
    md5 (buffer) {
        const md5 = crypto.createHash('md5');
        return md5.update(buffer).digest('hex');
    },
    unlink (path) {
        return new Promise((resolve, reject) => {
            fs.unlink(path, err => {
                if (err) {
                    reject(err);
                } else {
                    resolve();
                }
            })
        })
    }
}